<?php
include 'inc/mysql.inc.php';
include 'inc/jssdk.php';
$sql = "SELECT * FROM `star` ORDER BY `id`";
$rs = query($sql);
$stars = fetch($rs);
$sql = "select sum(vote) as v from `star`";
$rs = query($sql);
$row = mysql_fetch_assoc($rs);
$total = $row['v'];

$sql = "select * from `record` where `rank`=1";
$rs = query($sql);
$rank1 = fetch($rs);
$sql = "select * from `record` where `rank`=2";
$rs = query($sql);
$rank2 = fetch($rs);
$sql = "select * from `record` where `rank`=3";
$rs = query($sql);
$rank3 = fetch($rs);
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>乐享真声音</title>
	<link rel="stylesheet" href="css/base.css" />
	<link rel="stylesheet" href="css/pages.css" />
	<link rel="stylesheet" href="lib/lightbox/css/lightbox.css" />
	<script type="text/javascript" src="http://libs.baidu.com/jquery/1.7.0/jquery.min.js"></script>
	<script type="text/javascript" src="js/head.js" ></script>
</head>
<body class="auto pr">
	<div class="pa index-bg">
		<img src="img/bg.jpg"/>
	</div>
	<div class="index-logo pa" style="z-index:2;"></div>
	<div class="index-images pa z2" id="bigBtn2">
		<a class="fl white no_unl r5 mr20 jl" href="img/jl.png" data-lightbox="roadtrip1">&nbsp;</a>
		<a class="fl white no_unl r5 mr20 ny" href="img/ny.png" data-lightbox="roadtrip2">&nbsp;</a>
		<a class="fl white no_unl r5 mr20 wf" href="img/wf.png" data-lightbox="roadtrip3">&nbsp;</a>
		<a class="fl white no_unl r5 hl" href="img/hl.png" data-lightbox="roadtrip">&nbsp;</a>
	</div>
	<img class="none mw fixed auto block" id="bigLogo"/>
	<div class="index-music-left pa"></div>
	<div class="index-music-right pa"></div>
	<div class="index-about pa oh z2 tc f20">
		<a href="javascript:void(0)" class="fr white no_unl r5" id="reward">获奖名单</a>
		<a href="javascript:void(0)" class="fr white no_unl mr10 r5" id="about">活动说明</a>
	</div>
	<div class="index-add pa oh z2 tc f18">
		<div class="oh" id="addBtns">
			<a href="javascript:void(0)" class="fl white no_unl r5 mr30 jl" data-id="1">选我</a>
			<a href="javascript:void(0)" class="fl white no_unl r5 mr30 ny" data-id="2">选我</a>
			<a href="javascript:void(0)" class="fl white no_unl r5 mr30 wf" data-id="3">选我</a>
			<a href="javascript:void(0)" class="fl white no_unl r5 hl" data-id="4">选我</a>
		</div>
		<p class="white tc f18 mt20">点击加油按钮为导师站队，赢好礼！</p>
	</div>
	<div class="index-data pa  clearfix z2 tc">
		<dl class="clearfix white">
			<dt class="fl f20">杰伦战队</dt>
			<dd class="pr fl tc ml5 jl f18">
				<p class="pa none"></p>
				<span id="jlNumber" data-number="true" class="none"><?php echo $stars[0]['vote'];?></span>
				<em id="jlLine" class="none"></em>
				<div class="pa none"></div>
			</dd>
		</dl>
		<dl class="clearfix white mt15">
			<dt class="fl f20">那英战队</dt>
			<dd class="pr fl tc ml5 ny f18">
				<p class="pa none"></p>
				<span id="nyNumber" data-number="true" class="none"><?php echo $stars[1]['vote'];?></span>
				<em id="nyLine" class="none"></em>
				<div class="pa"></div>
			</dd>
		</dl>
		<dl class="clearfix white mt15">
			<dt class="fl f20">汪峰战队</dt>
			<dd class="pr fl tc ml5 wf f18">
				<p class="pa none"></p>
				<span id="wfNumber" data-number="true" class="none"><?php echo $stars[2]['vote'];?></span>
				<em id="wfLine" class="none"></em>
				<div class="pa none"></div>
			</dd>
		</dl>
		<dl class="clearfix white mt15">
			<dt class="fl f20">哈林战队</dt>
			<dd class="pr fl tc ml5 hl f18">
				<p class="pa none"></p>
				<span id="hlNumber" data-number="true" class="none"><?php echo $stars[3]['vote'];?></span>
				<em id="hlLine" class="none"></em>
				<div class="pa none"></div>
			</dd>
		</dl>
		<a class="oh block auto index-data-get disable no_unl white f30 mt50" id="getRight" href="javascript:void(0)">
			立刻抽奖
		</a>
	</div>
	<div class="index-aboutinfo pa none w640" id="aboutData">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				活动说明
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150">
				<p class="c_ffba1b">活动时间：</p>
				<p class="f18 white mt20">9月29日——10月3日</p>
				<p class="c_ffba1b mt30 pt10">活动奖品：</p>
				<p class="f18 white mt20">一等奖：价值680元以上的第四季《中国好声音》决赛门票1张，共7张</p>
				<p class="f18 white mt20">二等奖：vivo原装移动电源1部，共10部</p>
				<p class="f18 white mt20">三等奖：拜亚动力耳机1条，共15条</p>
				<p class="c_ffba1b mt30 pt10">备    注：</p>
				<p class="f18 white mt20">第四季《中国好声音》决赛现场门票信息：</p>
            		<p class="f18 white mt20">时间：10月7日19:00；地点：北京鸟巢-国家体育馆。</p>
				<p class="c_ffba1b mt30 pt10">活动规则：</p>
				<p class="f18 white mt20">1.每个网友有且只有一次投票机会，投票完成即可进行抽奖，每人有3次抽奖机会。</p>
				<p class="f18 white mt20">2.获奖后请于10月6日前填写姓名、联系方式和收件地址，奖品将在20个工作日内寄出。逾期将视为放弃（好声音决赛门票将单独联系获奖者）</p>
				<p class="f18 white mt20">3.此次活动只提供好声音决赛现场门票，不包含往返机票、食宿等其他费用。</p>
				<p class="f18 white mt20">4.活动最终解释权归vivo官方所有。</p>
			</div>
		</div>
		
		<a href="javascript:void(0)" class="pa white no_unl block tc r5 f18 back">返回</a>
	</div>
	<div class="index-aboutinfo pa none w640" id="sadData" style="z-index: 88;">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				<img src="img/mm1.png"/>
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150">
				<p class="c_ffba1b tc">抽奖的姿势不对，没有中奖。</p>
				<p class="c_ffba1b tc mt20">感谢你的参与，么么哒~</p>
				<a href="javascript:void(0)" class="auto mt30 white no_unl block tc r5 f18 back" style="background:#ffba1b;border:none;">确定</a>
			</div>
		</div>
	</div>
	<div class="index-aboutinfo pa none w640" id="happyData" style="z-index: 88;">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				<img src="img/mm2.png"/>
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150">
				<p class="c_ffba1b tc">恭喜你中奖啦，快去填写中奖信息吧^^</p>
				<a href="javascript:void(0)" class="auto mt30 white no_unl block tc r5 f18 back" style="background:#ffba1b;border:none;">确定</a>
			</div>
		</div>
	</div>
	<div class="index-reward pa none w640" id="rewardData">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				获奖名单
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150 tc">
				<p class="c_ffba1b">一等奖</p>
				<p class="f18 white mt20">
					<?php 
					for($i=0;$i<count($rank1);$i++){ 
						echo $rank1[$i]['name'];
						echo ' ';
					}	
					?>
				</p>
				<p class="c_ffba1b mt30 pt10">二等奖</p>
				<p class="f18 white mt20">
					<?php 
					for($i=0;$i<count($rank2);$i++){ 
						echo $rank2[$i]['name'].' ';
					}	
					?>
				</p>
				<p class="c_ffba1b mt30 pt10">三等奖</p>
				<p class="f18 white mt20">
					<?php 
					for($i=0;$i<count($rank3);$i++){ 
						echo $rank3[$i]['name'].' ';
					}	
					?>
				</p>
			</div>
		</div>
		<a href="javascript:void(0)" class="pa white no_unl block tc r5 f18 back">返回</a>
	</div>
	<div class="index-login fixed auto none w640" id="loginData">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				登录即可抽奖哦
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150 tc white f24">
				<form>
					<p>
						<label>姓名</label>
						<input type="text" name="name" class="r5" id="loginName"/>
					</p>
					<p class="mt30">
						<label>手机</label>
						<input type="tel" name="phone" class="r5" id="loginPhone"/>
					</p>
				</form>
			</div>
			<a class="oh block auto index-login-get no_unl white f28 mt50 tc" id="loginSubmit" href="javascript:void(0)">
				登录
			</a>
		</div>
		<a href="javascript:void(0)" class="pa white no_unl block tc r5 f18 back">返回</a>
	</div>
	<div class="index-login fixed none auto w640" id="fillData">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				填写个人信息
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150 tc white f24">
				<form>
					<p>
						<label>姓名</label>
						<input type="text" name="name" class="r5" id="fillName"/>
					</p>
					<p class="mt30">
						<label>电话</label>
						<input type="tel" name="phone" class="r5" id="fillPhone"/>
					</p>
					<p class="mt30">
						<label>地址</label>
						<input type="text" name="address" class="r5" id="fillAddress"/>
					</p>
				</form>
			</div>
			<a class="oh block auto index-login-get no_unl white f28 mt50 tc" id="fillSubmit" href="javascript:void(0)">
				提交信息
			</a>
		</div>
		<a href="javascript:void(0)" class="pa white no_unl block tc r5 f18 back">返回</a>
	</div>
	<div class="index-reward pa none  w640" id="getData">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				幸运抽奖
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150 tc">
				<p class="f18 white mt20">点击开始按钮抽奖，当抽奖画面停止时，三个画面所显示奖品为同一奖品时即中该奖！</p>
			</div>
			<div class="mt50 index-get-infos auto">
				<div id="machine1" class="slotMachine">
					<div class="slot slot1"></div>
					<div class="slot slot2"></div>
					<div class="slot slot3"></div>
				</div>
				<div id="machine2" class="slotMachine">
					<div class="slot slot1"></div>
					<div class="slot slot2"></div>
					<div class="slot slot3"></div>
				</div>
				<div id="machine3" class="slotMachine">
					<div class="slot slot1"></div>
					<div class="slot slot2"></div>
					<div class="slot slot3"></div>
				</div>
			</div>
			<a class="block auto index-login-get no_unl white f28 mt50 tc pr" id="slotMachineButton1" href="javascript:void(0)">
				开始抽奖<span class="pa get-number f16 w200 tl"><span id="hasChoice">3</span>次机会</span>
			</a>
		</div>
		<a href="javascript:void(0)" class="pa white no_unl block tc r5 f18 back">返回</a>
	</div>
	
	<div class="index-aboutinfo fixed none w640" id="myAlertData" style="z-index: 88;left:auto;">
		<div class="index-logo pa"></div>
		<img src="img/pop_bg.png" class="abs-left pa"/>
		<div class="abs-left pa z2 w f18">
			<h1 class="pop-title oh c_ffba1b w tc">
				<img src="img/mm1.png"/>
			</h1>
			<div class="pl50 pr50 mt30 pt10 lh150">
				<p class="c_ffba1b tc" id="myAlertInfo"></p>
				<a href="javascript:void(0)" class="auto mt30 white no_unl block tc r5 f18 back" style="background:#ffba1b;border:none;">确定</a>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="js/jquery.cookie.js" ></script>
	<script type="text/javascript" src="lib/lightbox/js/lightbox.js" ></script>
	<script type="text/javascript" src="js/jquery.slotmachine.js" ></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script>
		var titles = ["10月7日中国好声音巅峰会战，据说有超过50%的人支持杰伦队夺冠，你支持谁？", "【有人@你】为中国好声音导师站队，赢《巅峰之夜》决赛现场门票。", "中国好声音巅峰会战，小公举杰伦VS半壁江山汪峰，你支持谁的队伍夺冠？快来投票"];
		var title = titles[<?php echo rand(0, 2)?>];
		var wxData = {
				"appId": "<?php echo $signPackage["appId"];?>", // 服务号可以填写appId
				"imgUrl": 'http://<?=$_SERVER["HTTP_HOST"]?>/img/share.jpg',
				"link": 'http://<?=$_SERVER["HTTP_HOST"]?>/index.php',
				"desc": "为您喜爱的导师站队，参与投票，赢取好声音《巅峰之夜》门票",
				"title": title
			};
		wx.config({
			debug: false,
			appId: '<?php echo $signPackage["appId"];?>',
			timestamp: <?php echo $signPackage["timestamp"];?>,
			nonceStr: '<?php echo $signPackage["nonceStr"];?>',
			signature: '<?php echo $signPackage["signature"];?>',
			jsApiList: [
			  // 所有要调用的 API 都要加到这个列表中
			'onMenuShareTimeline',
			'onMenuShareAppMessage'
			]
			});
			wx.ready(function(){
				wx.onMenuShareAppMessage({
					title: "你有一张门票未领取", // 分享标题
					desc: "为中国好声音导师站队，赢《巅峰之夜》决赛现场门票。你支持谁？快来投票", // 分享描述
					link: wxData.link, // 分享链接
					imgUrl: wxData.imgUrl, // 分享图标
					type: 'link', // 分享类型,music、video或link，不填默认为link
					dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
					success: function(){
						
					},
					cancel: function () { 
						// 用户取消分享后执行的回调函数
					}
				});
				wx.onMenuShareTimeline({
					title: wxData.title, // 分享标题
					link: wxData.link, // 分享链接
					imgUrl: wxData.imgUrl, // 分享图标
					success: function(){
						
					},
					cancel: function () { 
						// 用户取消分享后执行的回调函数
					}
				});
			});
	</script>
	<script>
		$("#about").click(function(){
			$("#aboutData").show();
		});
		$("#aboutData a.back").click(function(){
			$("#aboutData").hide();
		});
		$("#reward").click(function(){
			$("#rewardData").show();
		});
		$("#rewardData a.back").click(function(){
			$("#rewardData").hide();
		});
		$("#getRight").click(function(){
			if ($(this).hasClass("disable")) return;
			$("#loginData").show();
		});
		$("#loginData a.back").click(function(){
			$("#loginData").hide();
		});
		$("#fillData a.back").click(function(){
			$("#fillData").hide();
		});
		
		$("#getData a.back").click(function(){
			$("#getData").hide();
		});
		$("#sadData a.back").click(function(){
			$("#sadData").hide();
		});
		$("#happyData a.back").click(function(){
			$("#happyData").hide();
		});
		$("#myAlertData a.back").click(function(){
			$("#myAlertData").hide();
		});

		function myAlert(info) {
			$("#myAlertInfo").html(info);
			$("#myAlertData").show();
		}

		var machine1 = $("#machine1").slotMachine({
			active: 0,
			delay: 200,
			stopIndex:0
		});
		
		var machine2 = $("#machine2").slotMachine({
			active: 1,
			delay: 200,
			stopIndex:1
		});
		
		var machine3 = $("#machine3").slotMachine({
			active: 2,
			delay: 200,
			stopIndex:2
		});
		var rewardInfo = -1;
		var finisheds = [false, false, false];
		var canGet = false;
		var reviece = false;
		var stop = true;
		function onComplete($el, active) {
			switch($el[0].id){
				case 'machine1':
					finisheds[0] = true;
					break;
				case 'machine2':
					finisheds[1] = true;
					break;
				case 'machine3':
					finisheds[2] = true;
					break;
			}
			for (var i = 0; i < finisheds.length; i++) {
				if (finisheds[i]==false) return;
			}
			if (canGet == true) return;
			canGet = true;
			stop = true;
			if (reviece == true) {
				setTimeout(function() {
					$("#happyData").show();
					$("#getData").hide();
					$("#fillData").show();
				}, 2000);
			} else {
				setTimeout(function() {
					//$("#sadData").show();
				}, 500);
			}
		}
		
		$("#slotMachineButton1").click(function() {
			if (stop == false) return;
			
			canGet = false;
			reviece = false;
			
			$.post("inc/draw.php", function(d){
				var data = eval('(' + d + ')');
				if (data.res == "success") {
					$("#hasChoice").text(data.choice);
					if (data.get == 1){
						reviece = true;
					}
					/*
					if (data.choice < 1) {
						myAlert("3次机会已已经用完");
						return;
					}
					*/
					machine1.shuffle(0,onComplete, data.datas[0] - 1);
					machine2.shuffle(0,onComplete, data.datas[1] - 1);
					machine3.shuffle(0,onComplete, data.datas[2] - 1);
				} else if (data.res == "nochoice"){
					$("#sadData").show();
					//myAlert("感谢您的参与，再接再厉吧！");
					$("#hasChoice").text(0);
					$("#getData").hide();
				}
			});
		});
		$("#addBtns a").bind("click", function(){
			var self = $(this);
			$("#addBtns a").removeClass("hover").text("选我")
			if($.cookie("vote")){
				myAlert("你已经投过票了");
				$("#addBtns a[data-id='"+($.cookie("vote")*1)+"']").text("已投").addClass("hover");
			} else {
				$.post("inc/vote.php", {"id":self.data("id")}, function(d){
					var data = eval('(' + d + ')');
					if (data.res == "exist") {
						myAlert("您已经投过票了");
					} else if(data.res == "error") {
						myAlert("系统异常");
					} else if(data.res == "success") {
						myAlert("投票成功");
						self.text("已投").addClass("hover");
						$.cookie("vote", self.data("id"), { expires: 7 });
						var numbers = $('[data-number="true"]');
						for (var i = 0; i < numbers.size(); i++) {
							numbers.eq(i).html(data.datas[i].vote);
						}
						initNumber(data.total);
					}
				})
			}
			$("body").scrollTop(600);
			$("#getRight").removeClass("disable")
			/*
			if (self.hasClass("hover")) {
				if($.cookie("vote")){
					myAlert("你已经投过票了");
				} else {
					$.post("inc/vote.php", {"id":self.data("id")}, function(d){
						var data = eval('(' + d + ')');
						if (data.res == "exist") {
							myAlert("您已经投过票了");
						} else if(data.res == "error") {
							myAlert("系统异常");
						} else if(data.res == "success") {
							myAlert("投票成功");
							$.cookie("vote", self.data("id"), { expires: 7 });
							var numbers = $('[data-number="true"]');
							for (var i = 0; i < numbers.size(); i++) {
								numbers.eq(i).html(data.datas[i].vote);
							}
							initNumber(data.total);
						}
					})
				}
				$("body").scrollTop(600);
				$("#getRight").removeClass("disable")
			} else {
				$("#addBtns a").removeClass("hover").text("选我")
				self.text("确定").addClass("hover");
			}*/
		});
		
		$("#bigBtn a").click(function(){
			var self = $(this);
			var img = self.data("image");
			$("#bigLogo").attr("src", img).show().css("left", (window.innerWidth - $("#bigLogo").width())/2);
		});
		$("#bigLogo").click(function(){
			$(this).hide();
		});
		
		function initNumber(total){
			var max = 0;
			var maxObj = -1;
			for (var i = 0; i < $('[data-number="true"]').size(); i++) {
				
				var count = $('[data-number="true"]').eq(i).text()* 1;
				if (count > max) {
					max = count;
					maxObj = $('[data-number="true"]').eq(i);
				}
				var per =  count / total;
				$('[data-number="true"]').eq(i).parent().children("em").css("width", per * 100 +"%");
				$('[data-number="true"]').eq(i).parent().children("p").html(parseInt(per.toFixed(2) * 100) +"%");
				$('[data-number="true"]').eq(i).parent().children("div").hide();
				
				if (per.toFixed(2) * 100 < 80) {
					$('[data-number="true"]').eq(i).parent().children("p").css("left",(per.toFixed(2) * 100 + 5) +"%");
				} else {
					$('[data-number="true"]').eq(i).parent().children("p").css("left","auto").css("right", "10%");
				}
				if ($.cookie("vote")) {
					$('[data-number="true"]').eq(i).parent().children("em").show();
					$('[data-number="true"]').eq(i).parent().children("p").show();
					$('[data-number="true"]').eq(i).show();
				} else {
					$('[data-number="true"]').eq(i).parent().children("em").hide();
					$('[data-number="true"]').eq(i).parent().children("p").hide();
					$('[data-number="true"]').eq(i).hide();
				}
				
			}
			if(maxObj != -1 && $.cookie("vote")) maxObj.parent().children("div").show();
		}
		initNumber('<?php echo $total; ?>');
		lightbox.option({
			'resizeDuration': 200,
			'wrapAround': true,
			maxWidth:620,
			positionFromTop:200
		});
	   
		$("#loginSubmit").click(function(){
			var phone = $("#loginPhone");
			var name = $("#loginName");
			
			if (phone.val() == '') {
				myAlert("手机不能为空");
				return;
			}
			
			var tel = phone.val(); //获取手机号
			var telReg = !!tel.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/);
			//如果手机号码不能通过验证
			if(telReg == false){
				myAlert("手机格式不正确");
				return;
			}
			
			if (name.val() == '') {
				myAlert("姓名不能为空");
				return;
			}
			$.post("inc/login.php",{"phone":phone.val(), "name": name.val()}, function(d){
				var data = eval('(' + d + ')');
				if(data.res == "success") {
					$.cookie("vote", data.vote, { expires: 7 });
					$("#hasChoice").text(data.choice);
					$("#loginData").hide();
					$("#getData").show();
					$("body").scrollTop(0);
				} else if(data.res == "fail") {
					myAlert("姓名不正确");
				} else if(data.res == "exist") {
					myAlert("您已经参加过vivo乐享真声音活动，感谢您的参与，谢谢");
					
				} else {
					myAlert("系统繁忙，请稍后再试");
				}
			});
			
		});
		$("#fillSubmit").click(function(){
			var phone = $("#fillPhone");
			var name = $("#fillName");
			var address = $("#fillAddress");
			if (phone.val() == '') {
				myAlert("手机不能为空");
				return;
			}
			var tel = phone.val(); //获取手机号
			var telReg = !!tel.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/);
			//如果手机号码不能通过验证
			if(telReg == false){
				myAlert("手机格式不正确");
				return;
			}
			if (name.val() == '') {
				myAlert("姓名不能为空");
				return;
			}
			if (address.val() == '') {
				myAlert("地址不能为空");
				return;
			}
			$.post("inc/record.php",{"phone":phone.val(), "name": name.val(), "address": address.val()}, function(d){
				var data = eval('(' + d + ')');
				if(data.res == "success") {
					myAlert("提交成功");
					$("#fillData").hide();
				} else if(data.res == "fail") {
					myAlert("手机号码或姓名与登陆信息不一致");
				}else {
					myAlert("系统繁忙，请稍后再试");
				}
			});
			
		});
		$(function(){
			if ($.cookie("vote")) {
				$("#addBtns a[data-id='"+($.cookie("vote")*1)+"']").text("已投").addClass("hover");
				$("#getRight").removeClass("disable");
			}
		});
	</script>
</body>
</html>
